package com.digua.base.dialog

import com.digua.base.base.Dialog
import com.digua.base.databinding.DialogPwdBinding

class PwdDialog : Dialog<DialogPwdBinding>() {
    var confirmListener: ((String) -> Boolean)? = null

    override fun initUI() {
        super.initUI()
        setWinWidth(0.5F)
        ui.cancel.setOnClickListener { dismiss() }
        ui.close.setOnClickListener { dismiss() }
        ui.confirm.setOnClickListener {
            val pwd = ui.pwd.text.toString().trim()
            val result = confirmListener?.let { it(pwd) } ?: false
            if (result) dismiss()
        }
    }
}